//
//  RootTableViewController.m
//  UI_homework
//
//  Created by 黄威 on 16/5/22.
//  Copyright © 2016年 黄威. All rights reserved.
//



#import "RootTableViewController.h"
#import "Data.h"
#import "Model.h"
#import "TableViewCell.h"


@interface RootTableViewController ()

@property(nonatomic,retain)Data *data;

@end

@implementation RootTableViewController

- (void)dealloc{
    
    [_data release];
    [super dealloc];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configNavigationItem];
    [self createTableViewCellPool];
    [self handleData];
    
}

#pragma mark - TableView

- (void)configNavigationItem{
    
    self.navigationItem.title = @"活动列表";
    
}

- (void)createTableViewCellPool{
    
    
    UINib *nib = [UINib nibWithNibName:@"TableViewCell" bundle:[NSBundle mainBundle]];
    
    [self.tableView registerNib:nib forCellReuseIdentifier:@"pool"];
    
}




- (void)handleData{
    
    self.data = [Data Data];
    
}





- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.data.DataArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
   
    
    
    TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pool" forIndexPath:indexPath];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.model = self.data.DataArr[indexPath.row];
    
    return cell;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return  160;
    
}









@end
